package com.buer.train.business.service.impl;

import com.buer.train.business.dao.DocDao;
import com.buer.train.business.domain.DocDO;
import com.buer.train.business.service.DocService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;



@Service
public class DocServiceImpl implements DocService {
	@Autowired
	private DocDao docDao;
	
	@Override
	public DocDO get(Integer id){
		return docDao.get(id);
	}
	
	@Override
	public List<DocDO> list(Map<String, Object> map){
		return docDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return docDao.count(map);
	}
	
	@Override
	public int save(DocDO doc){
		return docDao.save(doc);
	}
	
	@Override
	public int update(DocDO doc){
		return docDao.update(doc);
	}
	
	@Override
	public int remove(Integer id){
		return docDao.remove(id);
	}
	
	@Override
	public int batchRemove(Integer[] ids){
		return docDao.batchRemove(ids);
	}

    @Override
    public PageInfo<DocDO> getDocList(Map<String, Object> map) {
        PageHelper.startPage(map); //开始起始页
        List<DocDO> list = docDao.getDocList(map); // 获取数据
        PageInfo<DocDO> page = new PageInfo<>(list); // 实例化PageInfo
        return page;
    }

    @Override
    public DocDO getOne(Map<String, Object> map){
        return docDao.getOne(map);
    }
	
}
